<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    async function main(){
        let p = new Promise(((resolve, reject) =>  {
            // resolve('ok')
            reject('error')
        }))
        //1.→侧promise的情况,会返回正确的promise的值
        let res = await p;
        console.log(res)
        //2.右侧是其他对象,那么就直接返回这个对象
        let res1 = 2
        console.log(res1)
        //3.右侧是promise的失败状态,那么会报错,需要使用try catch捕捉
        try{
            let res2 = await p
        }catch (e){
            console.log(e)
        }
    }

</script>
</body>
</html>
